package com.isi.mtl.lf.ex3.managers;

import java.sql.SQLException;
import java.util.ArrayList;

import com.isi.mtl.lf.ex3.entites.Camion;
import com.isi.mtl.lf.ex3.services.BDDMapConfig;

public class CamionManager {

	@SuppressWarnings("unchecked")
	public static ArrayList<Camion> getCamionByIdModele(int idModele){
		
		ArrayList<Camion> alCamions = null;
		
		try {
			alCamions = (ArrayList<Camion>) BDDMapConfig.getBddMapClient().queryForList("selectCamionByIdModele", idModele);
			
			for(Camion c: alCamions) {
				System.out.println(" id camion"+c.getIdCamion()+" Id modele "+c.getIdModele()+" id rack"+c.get_idRack());
			}
			
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return alCamions;
		
	}
	
	public static Camion getCamionByCamionId(int id){
		Camion m = null;
		try {
			m = (Camion)BDDMapConfig.getBddMapClient().queryForObject("selectCamionByIdCamion", id);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} 
		
		return m;
	}
	
	
	
}
